home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2009 February / PCWFEB09.iso / Software / Resources / Chat & Communication / Digsby build 37 / digsby_setup.exe / lib / gui / authorizationdialog.pyo (.txt) < prev    next >
Python Compiled Bytecode  |  2008-10-13  |  3KB  |  76 lines

  1. # Source Generated with Decompyle++
  2. # File: in.pyo (Python 2.5)
  3.  
  4. import wx
  5. from gui.addcontactdialog import AddContactDialog
  6. from gui import skin
  7. LEFTLESS = wx.ALL & ~(wx.LEFT)
  8.  
  9. def _(s):
  10.     return s
  11.  
  12. authdialog_style = wx.DEFAULT_FRAME_STYLE & ~(wx.RESIZE_BORDER) | wx.STAY_ON_TOP
  13.  
  14. class AuthorizationDialog(wx.Frame):
  15.     
  16.     def __init__(self, protocol, buddy, message, username_added, callback = None):
  17.         wx.Frame.__init__(self, None, -1, _('Authorize Contact'), style = authdialog_style)
  18.         self.SetFrameIcon(skin.get('appdefaults.taskbaricon'))
  19.         p = wx.Panel(self)
  20.         self.Sizer = wx.BoxSizer(wx.VERTICAL)
  21.         self.Sizer.Add(p, 1, wx.EXPAND)
  22.         self.protocol = protocol
  23.         self.buddy = buddy
  24.         self.username_added = username_added
  25.         self.callback = callback
  26.         bitmap = wx.ArtProvider.GetBitmap(wx.ART_QUESTION)
  27.         bitmap.SetMaskColour(wx.BLACK)
  28.         sbitmap = wx.StaticBitmap(p, -1, bitmap)
  29.         text = wx.StaticText(p, -1, message)
  30.         addbutton = wx.Button(p, wx.YES, _('Authorize and Add'))
  31.         authbutton = wx.Button(p, wx.OK, _('Authorize'))
  32.         denybutton = wx.Button(p, wx.NO, _('Deny'))
  33.         selfSizer = p.Sizer = wx.BoxSizer(wx.VERTICAL)
  34.         topSizer = wx.BoxSizer(wx.HORIZONTAL)
  35.         buttonSizer = wx.BoxSizer(wx.HORIZONTAL)
  36.         topSizer.Add(sbitmap, 0, wx.ALIGN_CENTER_VERTICAL | wx.ALIGN_LEFT | wx.RIGHT, 8)
  37.         topSizer.Add(text, 0, wx.ALIGN_CENTER_VERTICAL | wx.ALIGN_LEFT)
  38.         buttonSizer.AddStretchSpacer()
  39.         add_flags = wx.ALIGN_CENTER_VERTICAL | wx.ALIGN_RIGHT | LEFTLESS
  40.         buttonSizer.AddMany([
  41.             (addbutton, 0, add_flags, 8),
  42.             (authbutton, 0, add_flags, 8),
  43.             (denybutton, 0, add_flags, 8)])
  44.         selfSizer.Add(topSizer, 1, wx.ALIGN_CENTER_HORIZONTAL)
  45.         selfSizer.Add(buttonSizer, 0, wx.EXPAND)
  46.         self.Fit()
  47.         self.Size += (40, 30)
  48.         self.Bind(wx.EVT_BUTTON, self.OnButton)
  49.         self.Bind(wx.EVT_CLOSE, self.OnClose)
  50.  
  51.     
  52.     def OnButton(self, event):
  53.         if event.Id == wx.YES:
  54.             AddContactDialog.MakeOrShow(service = self.protocol.service, name = unicode(self.buddy))
  55.             self.callback(self.buddy, True, self.username_added)
  56.         elif event.Id == wx.OK:
  57.             self.callback(self.buddy, True, self.username_added)
  58.         elif event.Id == wx.NO:
  59.             self.callback(self.buddy, False, self.username_added)
  60.         
  61.         self.Close()
  62.  
  63.     
  64.     def OnClose(self, event):
  65.         self.Hide()
  66.         self.Destroy()
  67.  
  68.  
  69. if __name__ == '__main__':
  70.     from tests.testapp import testapp
  71.     app = testapp()
  72.     ad = AuthorizationDialog(None, None, 'Allow SomeBuddy to add you as a buddy as YourNick on Protocol?')
  73.     ad.Show()
  74.     app.MainLoop()
  75.  
  76.